TQADrawPrivateNew
A drawing engine must define a method to create its own private data and initialize a new draw context.
typedef TQAError (*TQADrawPrivateNew) ( TQADrawContext *newDrawContext, const TQADevice *device, const TQARect *rect, const TQAClip *clip, unsigned long flags);
newDrawContext
- The draw context to initialize. On entry, all the fields of this structure have the value
NULL
.device
- A device.
rect
- The rectangular region (specified in device coordinates) of the specified device that can be drawn into by the drawing engine associated with the new draw context.
clip
- The two-dimensional clipping region for the new draw context, or
NULL
if no clipping is desired. This parameter must be set toNULL
for devices of typekQADeviceMemory
.flags
- A set of bit flags specifying features of the new draw context. See "Draw Context Flags Masks" (page 1-65) for complete information.
DESCRIPTION
YourTQADrawPrivateNew
function is called whenever an application callsQADrawContextNew
to create a new draw context associated with your drawing engine. Your function should perform any initialization required for the new draw context. In particular, it should return a pointer to the draw context's private data in thedrawPrivate
field of the draw context structure pointed to by thenewDrawContext
parameter. In addition, yourTQADrawPrivateNew
function should set any other fields of that draw context structure to point to public draw context methods defined by the drawing engine.Because it is the responsibility of your
TQADrawPrivateNew
function to initialize the fields of a draw context structure, you can load different methods depending on the features of the device or draw context specified by thedevice
andflags
parameters. For instance, you might load one line drawing function for a device that displays 16 bits per pixel and a different line drawing function for a device that displays 32 bits per pixel. This technique allows you to avoid testing the display depth each time you draw a line.SEE ALSO
See Listing 1-8 (page 1-26) for a sampleTQADrawPrivateNew
function.
Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help